﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zor_DAL;
using Zor_Modes;
using Zor_Tools;

namespace Zor_Bll
{

    public class TaxRevenueStat_Bll<T> where T : class
    {

        /// <summary>
        /// 获取税收统计表
        /// </summary>
        /// <param name="index">页码</param>
        /// <param name="TotalCount">返回值</param>
        /// <returns></returns>
        public static List<T> GetPageList(dynamic Model, int index, out int TotalCount, string where)
        {
            var sqlSurch = string.Empty;
        
            if (Model.Y_YearMonth != null)
            {
                sqlSurch += "Y_YearMonth like '%" + Model.Y_YearMonth + "%' and ";
            }

            if (Model.Jb != null)
            {
                sqlSurch += "Jb like '%" + Model.Jb + "%' and ";
            }
            if (Model.Dt_Name != null)
            {
                sqlSurch += "Dt_Name like '%" + Model.Dt_Name + "%' and ";
            }
            if (Model.Pt_ActualTax != 0)
            {
                sqlSurch += " Pt_ActualTax like '%" + Model.Pt_ActualTax + "%' and ";
            }
     
            sqlSurch += " 1=1 ";
            return PagerHelp<T>.GetPagerList(index, "V_TaxRevenueStat", "Dt_Id", out TotalCount, sqlSurch);
        }

        /// <summary>
        /// 导出税收统计表（不分页）
        /// create zhl by 2017.4.1     
        /// </summary>
        /// <returns></returns>
        public static List<T> GetList(string where)
        {
            return TaxRevenueStat_DAL<T>.SelectViewTaxRevenueStat(where);
        }

    }
}
